package com.ruoyi.function.mapper;

import java.util.Date;
import java.util.List;
import com.ruoyi.function.domain.Orders;
import io.lettuce.core.dynamic.annotation.Param;

/**
 * 订单Mapper接口
 * 
 * @author ruoyi
 * @date 2025-03-20
 */
public interface OrdersMapper 
{
    /**
     * 查询订单
     * 
     * @param orderId 订单主键
     * @return 订单
     */
    public Orders selectOrdersByOrderId(Long orderId);

    /**
     * 查询订单列表
     * 
     * @param orders 订单
     * @return 订单集合
     */
    public List<Orders> selectOrdersList(Orders orders);

    /**
     * 新增订单
     * 
     * @param orders 订单
     * @return 结果
     */
    public int insertOrders(Orders orders);

    /**
     * 修改订单
     * 
     * @param orders 订单
     * @return 结果
     */
    public int updateOrders(Orders orders);

    /**
     * 删除订单
     * 
     * @param orderId 订单主键
     * @return 结果
     */
    public int deleteOrdersByOrderId(Long orderId);

    /**
     * 批量删除订单
     * 
     * @param orderIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteOrdersByOrderIds(Long[] orderIds);

    void deleteOrdersByParentOrder(Long parentOrder);

    int updateOrderStatus( @Param("param1") Long targetParentOrderId,@Param("param2") int i);

    // OrdersMapper.java
    int updateOrderStatusByParentOrder(
            @Param("param1") Long parentOrderId,  // 明确父订单ID参数名
            @Param("param2") String orderStatus        // 明确状态参数名
    );

    /**
     *
     * @param orderStatus 订单状态
     * @param paymentTime 支付时间
     * @return
     */

    List<Orders> selectOrdersByStatusAndCreateTime(@Param("param1") String orderStatus,@Param("param2") Date paymentTime );



    int updateOrdersByCreateTime(Date tenMinutesAgo);

    List<Orders> selectOrdersByParentOrderType(Long orderId);

    /**
     * 查询我的订单
     * @param orders
     * @return
     */
    List<Orders> selectMyOrders(Orders orders);
}
